<!--
 * @Author: tkp
 * @Date: 2024-03-29 10:17:43
-->
<template>
  <div>
    <el-form :model="queryForm" label-position="right" :rules="rules" ref="ruleForm" label-width="130px">
      <el-form-item prop="adminName" label="系统管理员名称:">
        <Input v-model="queryForm.adminName" size="medium" clearable placeholder="请输入系统管理员名称"></Input>
      </el-form-item>
      <el-form-item prop="sysAdminAccount" label="系统管理员账号:">
        <Input v-model="queryForm.sysAdminAccount" size="medium" clearable placeholder="请输入系统管理员账号"></Input>
      </el-form-item>
      <el-form-item prop="password" label="系统管理员密码:">
        <Input v-model="queryForm.password" size="medium" clearable placeholder="请输入系统管理员密码"></Input>
      </el-form-item>
      <el-form-item prop="defaultFlag" label="是否默认:">
        <el-radio-group v-model="queryForm.defaultFlag">
          <el-radio :label="0">否</el-radio>
          <el-radio :label="1">是</el-radio>
        </el-radio-group>
      </el-form-item>
      <el-form-item prop="enable" label="是否可用:">
        <el-radio-group v-model="queryForm.enable">
          <el-radio :label="0">否</el-radio>
          <el-radio :label="1">是</el-radio>
        </el-radio-group>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" size="medium" @click="okPop">确认</el-button>
        <el-button size="medium" @click="closePop">取消</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
export default {
  data() {
    return {
      queryForm: {
        adminName: '',
        sysAdminAccount: '',
        defaultFlag: 0,
        enable: 0,
        password: '',
      },
      rules: {
        adminName: [
          { required: true, message: '此项为必填' },
        ],
        sysAdminAccount: [
          { required: true, message: '此项为必填' },
        ],
        defaultFlag: [
          { required: true, message: '此项为必填' },
        ],
        enable: [
          { required: true, message: '此项为必填' },
        ],
        password: [
          { required: true, message: '此项为必填' },
        ],
      },
    }
  },
  mounted() {

  },
  methods: {
    closePop() {
      this.$emit('addData', '')
    },
    okPop() {
      this.$refs['ruleForm'].validate((valid) => {
        if (valid) {
          this.$emit('addData', this.queryForm)
        } else {
          this.messageWarnPop('请填写完整')
          return false;
        }
      });
    },


  }
}
</script>

<style lang="scss" scoped>
</style>
